// Package requests 处理请求数据和表单验证
package requests

import (
	"github.com/gofiber/fiber/v2"
	"github.com/thedevsaddam/govalidator"
)

type UserFollowRequest struct {
	FollowId uint64 `json:"follow_id" valid:"follow_id"`
}

// https://pkg.go.dev/github.com/thedevsaddam/govalidator@v1.9.10#section-readme
func ValidateUserFollow(c *fiber.Ctx, request *UserFollowRequest) map[string][]string {
	c.BodyParser(request)
	rules := govalidator.MapData{
		"follow_id": []string{"required"},
	}

	messages := govalidator.MapData{
		"follow_id": []string{
			"required:follow id 错误",
		},
	}

	return Validate(request, rules, messages)
}
